package loads

import (
	"gvm/instructions/base"
	"gvm/rtda"
)

type ALOAD struct {
	base.Index8Instruction
}

func (self *ALOAD) Execute(jFrame *rtda.JFrame) {
	_aload(jFrame, self.Index)
}

type ALOAD_0 struct {
	base.NoOperandsInstruction
}

func (self *ALOAD_0) Execute(jFrame *rtda.JFrame) {
	_aload(jFrame, 0)
}

type ALOAD_1 struct {
	base.NoOperandsInstruction
}

func (self *ALOAD_1) Execute(jFrame *rtda.JFrame) {
	_aload(jFrame, 1)
}

type ALOAD_2 struct {
	base.NoOperandsInstruction
}

func (self *ALOAD_2) Execute(jFrame *rtda.JFrame) {
	_aload(jFrame, 2)
}

type ALOAD_3 struct {
	base.NoOperandsInstruction
}

func (self *ALOAD_3) Execute(jFrame *rtda.JFrame) {
	_aload(jFrame, 3)
}

func _aload(jFrame *rtda.JFrame, index uint) {
	ref := jFrame.LocalVars().GetRef(index)
	jFrame.OperandStack().PushRef(ref)
}
